************
Installation
************

.. highlight:: bash


License
=======

SieveManager is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SieveManager is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the :doc:`GNU General Public
License <license>` for more details.


Requirements
============

* A Unix-like operating system (e.g., BSD, illumos, Linux, or macOS)

* Python_ ≥ v3.9

* When installing from the tarball_ or the Python Package Index,
  the `Package Installer for Python`_


Debian Package
==============

The Debian package targets Debian ≥ v11 ("bullseye") and systems based on
Debian ≥ v11 (e.g., recent-ish versions of Mint, MX, Pop!_OS, Ubuntu, or
Zorin). 

Add the Codeberg repository key::

    sudo curl -o /etc/apt/trusted.gpg.d/org_codeberg_odkr.asc \
        https://codeberg.org/api/packages/odkr/debian/repository.key

Add my repository::

    sudo tee /etc/apt/sources.list.d/org_codeberg_odkr.list <<EOF
    deb https://codeberg.org/api/packages/odkr/debian bullseye main
    EOF

Update the package index::

    sudo apt-get update

Install SieveManager::

    sudo apt-get install sievemgr


Python Package Index
====================

Install SieveManager::

    pip install sievemgr

.. note::
    This package ships *without* the manual pages for :doc:`sievemgr
    <command>` and :doc:`sieve.cf <config>` and the `shell completion
    scripts <EXTRAS_>`_.


Tarball
=======

Preparation
-----------

Import my `PGP key`_, so that you can check whether
the tarball has been tampered with::

    gpg --keyserver keys.openpgp.org --recv-keys 6B06A2E03BE31BE9


Download
--------

Download the tarball:

.. code-block::
    :substitutions:

    curl -O https://codeberg.org/odkr/sievemgr/releases/download/v|release|/sievemgr-|release|.tgz

Check whether the tarball has been tampered with:

.. code-block::
    :substitutions:

    curl -O https://codeberg.org/odkr/sievemgr/releases/download/v|release|/sievemgr-|release|.tgz.asc
    gpg --verify sievemgr-|release|.tgz.asc

Unpack the tarball:

.. code-block::
    :substitutions:

    tar xzf sievemgr-|release|.tgz

Go to the package directory to proceed with the installation:

.. code-block::
    :substitutions:

    cd sievemgr-|release|

.. TIP::
    Subscribe to https://codeberg.org/odkr/sievemgr/releases.rss
    to be notified about new releases.


.. highlight:: bash

.. include:: ../INSTALL.rst


Extras
======

Bash completion
---------------

The :download:`Bash completion script <../comp/sievemgr.bash>`
should work automatically if bash-completion_ is installed.

However, it can also be loaded by adding, for example,

.. code:: bash

    source "$HOME/.local/share/bash-completion/completions/sievemgr.bash"

to your :file:`.bashrc`.


Zsh completion
--------------

The :download:`Zsh completion script <../comp/sievemgr.zsh>`
targets Zsh's `modern completion system <Zsh completion_>`_.

It can be activated by adding, for example,

.. code:: zsh

    fpath+=("$HOME/.local/share/zsh-completions")

    autoload -Uz compinit
    compinit

to your :file:`.zshrc`.

